/**
 * Class for storing the dependent step
 * @author ColorLee
 *
 */
public class Dependent {
	
	public final static int isLeft = 0; //this dependent is from left sub tree of right sub tree, 0 for left, 1 for right, 2 for both sub tree
	public final static int isRight = 1;
	public final static int isLeftAndRight = 2;

	private int firstStep = -1;
	private int secondStep = -1;
	private int direction = -1; 
	
	/**
	 * Constructor for single step dependent
	 * @param firstStep the first step number of dependent
	 */
	public Dependent(int firstStep, int direction){
		setFirstStep(firstStep);
		setDirection(direction);
	}
	
	/**
	 * Constructor for two steps dependent
	 * @param firstStep the first step number of dependent
	 * @param secondStep the second step number of dependent
	 */
	public Dependent(int firstStep, int secondStep, int direction){
		setFirstStep(firstStep);
		setSecondStep(secondStep);
		setDirection(direction);
	}
	
	/**
	 * Function for setting the first step number of dependent
	 * @param firstStep the first step number of dependent
	 */
	public void setFirstStep(int firstStep){
		this.firstStep = firstStep;
	}
	
	/**
	 * Function for getting the first step number of dependent
	 * @return the first step number of dependent
	 */
	public int getFirstStep(){ 
		return firstStep;
	}
	
	/**
	 * Function for setting the second step number of dependent
	 * @param secondStep the second step number of dependent
	 */
	public void setSecondStep(int secondStep){
		this.secondStep = secondStep;
	}
	
	/**
	 * Function for getting the second step number of dependent
	 * @return the second step number of dependent
	 */
	public int getSecondStep(){
		return secondStep;
	}
	
	public void setDirection(int direction){
		this.direction = direction;
	}
	
	public int getDirection(){
		return direction;
	}	
	
	/**
	 * Function for getting the description of this dependent
	 * @return Description sentence for this dependent
	 */
	public String toString(){    	
    	String description = " [Dependent on step " + firstStep;
		if (secondStep != -1)
			description += " and step " + secondStep;
		description += "]";
		return description;
	}
}
